# RUN: llc -mtriple=aarch64-apple-darwin -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
# In bb.4,  we save + restore LR using a register. We need LR to be live-in to
# the block to prevent MachineVerifier errors.

name:            lr_not_live_in
tracksRegLiveness: true
fixedStack:
machineFunctionInfo:
  hasRedZone:      false
body:             |
  bb.0:
    $x9 = ORRXri $xzr, 1
  bb.1:
    liveins: $w9
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 2
  bb.2:
    liveins: $w9
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 2
  bb.3:
    liveins: $w9
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 2
  bb.4:
    liveins: $w9
    ; CHECK-LABEL: bb.4
    ; CHECK: liveins: $w9, $lr
    ; CHECK: BL
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 1
    $w9 = ORRWri $wzr, 2
  bb.5:
    liveins: $w9, $lr
    RET undef $lr
